import { isRef, unref, Ref } from 'vue'
/* type */
import type { ProcessNodeListItem } from '@src/modules/trigger/model/interface/index.ts'

/**
 * @description 获取节点类型
 */
export const getNodeType = (node: ProcessNodeListItem | Ref<ProcessNodeListItem>) => {
    if (!node) return
    const nodeData = (isRef(node) ? unref(node) : node) as unknown as ProcessNodeListItem
    if(['code', 'message'].includes(nodeData.options?.apiId)){
        return nodeData.options?.apiId 
    }
    return nodeData.options?.type || nodeData.type

}